﻿using Microsoft.VisualStudio.TextTemplating;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABPGenerator.Db
{
    //定义管理策略类
    class ManagementStrategy
    {
        internal static ManagementStrategy Create(ITextTemplatingEngineHost host)
        {
            return (host is IServiceProvider) ? new VSManagementStrategy(host) : new ManagementStrategy(host);
        }

        internal ManagementStrategy(ITextTemplatingEngineHost host) { }

        internal virtual void CreateFile(String fileName, String content)
        {
            File.WriteAllText(fileName, content);
        }

        internal virtual void DeleteFile(String fileName)
        {
            if (File.Exists(fileName))
                File.Delete(fileName);
        }
    }

}
